package com.atguigu.tingshu.account.service;

import com.atguigu.tingshu.model.account.UserAccount;
import com.atguigu.tingshu.model.account.UserAccountDetail;
import com.atguigu.tingshu.vo.account.AccountDeductVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.Map;

public interface UserAccountService extends IService<UserAccount> {


    /**
     * 保存用户账户
     * @param map
     */
    void saveUserAccount(Map<String, Object> map);

    /**
     * 保存用户账户明细
     * @param userId
     * @param title
     * @param amount
     * @param orderNo
     */
    void saveUserAccountDetail(Long userId, String title,String tradeType, BigDecimal amount, String orderNo);

    /**
     * 获取用户账户可用余额
     * @param userId
     * @return
     */
    BigDecimal getAvailableAmount(Long userId);

    /**
     * 检测并扣除用户账户
     * @param accountDeductVo
     */
    void checkAndDeduct(AccountDeductVo accountDeductVo);


    /**
     * 获取用户充值或消费记录
     * @param pageInfo
     * @param userId
     * @return
     */
    void findUserRechargeOrConsumePage(Page<UserAccountDetail> pageInfo, String tradeType, Long userId);
}
